home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
051-060
/
amok56
/
m2maker
/
txt
/
lsoptions.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
5KB
|
154 lines
(*---------------------------------------------------------------------------
:Program. m2Maker
:Author. Thomas Stolze
:Address. Goslarsche Str. 32, 3000 Hannover 21, Germany
:Phone. (0)511 / 75 10 77
:Version. V2.0
:Date. 10-Nov-90
:Copyright. Shareware
:Language. Modula-2
:Translator. M2Amiga V3.32d
:Contents. Programming Utility.
:Remark. Supports the M2Amiga System (C) by A+L AG Switzerland
---------------------------------------------------------------------------*)
IMPLEMENTATION MODULE LSOptions;
IMPORT String;
FROM Arts IMPORT Assert;
FROM FileRequester IMPORT LoadDir;
FROM FileSystem IMPORT Close,File,Lookup,ReadBytes,ReadChar,Response,
WriteBytes,WriteChar;
FROM InitIntuition IMPORT prgPtr,PrintStatus;
FROM InstallOptions IMPORT ResidentCompiler,ResidentLinker,
ResidentEditor,InstallDebug,InstallPool,
InstallM2Ohm;
FROM IntuitionD IMPORT GadgetFlags,GadgetFlagSet,PropInfoPtr,
MenuItemFlags,MenuItemFlagSet;
FROM IntuitionL IMPORT ClearMenuStrip,RefreshGList,SetMenuStrip;
FROM Routines IMPORT GetDosErr,Project,SwitchGadget,InteractiveCompiler,
InclChecked,ExclChecked;
FROM SYSTEM IMPORT ADR;
CONST version = 3;
PROCEDURE SaveOptions(save : ARRAY OF CHAR);
VAR file : File;
i,len : INTEGER;
actual : LONGINT;
bool : BOOLEAN;
ptr : PropInfoPtr;
BEGIN
Lookup(file,save,1024,TRUE);
IF file.res = done THEN
WriteChar(file,CHR(version));
ptr:=ADR(prgPtr^.FR.datas^.GadgetArray[0].specialInfo);
WriteBytes(file,ADR(ptr^.vertPot),SIZE(ptr^.vertPot),actual);
FOR i:=0 TO 16 DO
len:=String.Length(prgPtr^.BufferString[i])+1; WriteChar(file,CHR(len));
WriteBytes(file,ADR(prgPtr^.BufferString[i]),len,actual);
END;
len:=String.Length(prgPtr^.FR.dirPath)+1; WriteChar(file,CHR(len));
WriteBytes(file,ADR(prgPtr^.FR.dirPath),len,actual);
len:=String.Length(prgPtr^.FR.file)+1; WriteChar(file,CHR(len));
WriteBytes(file,ADR(prgPtr^.FR.file),len,actual);
len:=String.Length(prgPtr^.FR.patternStr)+1; WriteChar(file,CHR(len));
WriteBytes(file,ADR(prgPtr^.FR.patternStr),len,actual);
ClearMenuStrip(prgPtr^.window);
FOR i:=15 TO 17 DO
bool:=(checked IN prgPtr^.MenuArray[i].flags);
WriteBytes(file,ADR(bool),SIZE(BOOLEAN),actual);
END;
FOR i:=25 TO 30 DO
bool:=(checked IN prgPtr^.MenuArray[i].flags);
WriteBytes(file,ADR(bool),SIZE(BOOLEAN),actual);
END;
Assert(SetMenuStrip(prgPtr^.window,prgPtr^.menuStripPtr),
ADR("Menu not initialised"));
bool:=(selected IN prgPtr^.GadgetArray[14].flags);
WriteBytes(file,ADR(bool),SIZE(BOOLEAN),actual);
bool:=(selected IN prgPtr^.GadgetArray[16].flags);
WriteBytes(file,ADR(bool),SIZE(BOOLEAN),actual);
END;
Close(file); GetDosErr;
END SaveOptions;
PROCEDURE LoadOptions(load : ARRAY OF CHAR);
VAR file : File;
i : INTEGER;
actual : LONGINT;
bool : BOOLEAN;
chr : CHAR;
ptr : PropInfoPtr;
BEGIN
Lookup(file,load,1024,FALSE);
IF file.res = done THEN
ReadChar(file,chr);
IF (INTEGER(chr) = version) THEN
ptr:=ADR(prgPtr^.FR.datas^.GadgetArray[0].specialInfo);
ReadBytes(file,ADR(ptr^.vertPot),SIZE(ptr^.vertPot),actual);
FOR i:=0 TO 16 DO
ReadChar(file,chr);
ReadBytes(file,ADR(prgPtr^.BufferString[i]),INTEGER(chr),actual);
prgPtr^.BufferString[i,INTEGER(chr)]:=00C;
END;
RefreshGList(ADR(prgPtr^.GadgetArray[0]),prgPtr^.window,NIL,4);
ReadChar(file,chr);
ReadBytes(file,ADR(prgPtr^.FR.dirPath),INTEGER(chr),actual);
prgPtr^.FR.dirPath[INTEGER(chr)]:=00C;
ReadChar(file,chr);
ReadBytes(file,ADR(prgPtr^.FR.file),INTEGER(chr),actual);
prgPtr^.FR.file[INTEGER(chr)]:=00C;
ReadChar(file,chr);
ReadBytes(file,ADR(prgPtr^.FR.patternStr),INTEGER(chr),actual);
prgPtr^.FR.patternStr[INTEGER(chr)]:=00C;
RefreshGList(ADR(prgPtr^.GadgetArray[21]),prgPtr^.window,NIL,10);
ClearMenuStrip(prgPtr^.window);
FOR i:=15 TO 17 DO
ReadBytes(file,ADR(bool),SIZE(BOOLEAN),actual);
IF bool THEN
INCL(prgPtr^.MenuArray[i].flags,checked);
ELSE
EXCL(prgPtr^.MenuArray[i].flags,checked);
END;
END;
FOR i:=25 TO 30 DO
ReadBytes(file,ADR(bool),SIZE(BOOLEAN),actual);
IF bool THEN
INCL(prgPtr^.MenuArray[i].flags,checked);
ELSE
EXCL(prgPtr^.MenuArray[i].flags,checked);
END;
END;
Assert(SetMenuStrip(prgPtr^.window,prgPtr^.menuStripPtr),
ADR("Menu not initialised"));
ReadBytes(file,ADR(bool),SIZE(BOOLEAN),actual); SwitchGadget(bool,14);
ReadBytes(file,ADR(bool),SIZE(BOOLEAN),actual); SwitchGadget(bool,16);
ELSE
PrintStatus("m2Maker.cfg not readable !");
END;
ELSE
PrintStatus("m2Maker.cfg not found !");
FOR i:=0 TO 15 DO prgPtr^.BufferString[i,0]:=00C; END;
END;
Close(file); GetDosErr;
LoadDir(ADR(prgPtr^.FR));
InstallDebug;
InstallM2Ohm;
ResidentCompiler;
ResidentLinker;
ResidentEditor;
InstallPool;
InteractiveCompiler;
END LoadOptions;
BEGIN
END LSOptions.